Implement n3584 - Addressing Tuples by Type git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@186237 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/utility b/include/utility index bea463b..3e4b401 100644 --- a/include/utility +++ b/include/utility
@@ -117,6 +117,15 @@ typename tuple_element<I, std::pair<T1, T2> >::type&& get(std::pair<T1, T2>&&) noexcept; +template<class T1, class T2> + constexpr T1& get(std::pair<T1, T2>&) noexcept; // C++14 + +template<size_t I, class T1, class T2> + constexpr T1 const& get(std::pair<T1, T2> const &) noexcept; // C++14 + +template<size_t I, class T1, class T2> + constexpr T1&& get(std::pair<T1, T2>&&) noexcept; // C++14 + // C++14 template<class T, T... I> @@ -602,6 +611,51 @@ #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #if _LIBCPP_STD_VER > 11 +template <class _T1, class _T2> +_LIBCPP_INLINE_VISIBILITY inline +constexpr _T1 & get(pair<_T1, _T2>& __p) _NOEXCEPT +{ + return __get_pair<0>::get(__p); +} + +template <class _T1, class _T2> +_LIBCPP_INLINE_VISIBILITY inline +constexpr _T1 const & get(pair<_T1, _T2> const& __p) _NOEXCEPT +{ + return __get_pair<0>::get(__p); +} + +template <class _T1, class _T2> +_LIBCPP_INLINE_VISIBILITY inline +constexpr _T1 && get(pair<_T1, _T2>&& __p) _NOEXCEPT +{ + return __get_pair<0>::get(_VSTD::move(__p)); +} + +template <class _T1, class _T2> +_LIBCPP_INLINE_VISIBILITY inline +constexpr _T1 & get(pair<_T2, _T1>& __p) _NOEXCEPT +{ + return __get_pair<1>::get(__p); +} + +template <class _T1, class _T2> +_LIBCPP_INLINE_VISIBILITY inline +constexpr _T1 const & get(pair<_T2, _T1> const& __p) _NOEXCEPT +{ + return __get_pair<1>::get(__p); +} + +template <class _T1, class _T2> +_LIBCPP_INLINE_VISIBILITY inline +constexpr _T1 && get(pair<_T2, _T1>&& __p) _NOEXCEPT +{ + return __get_pair<1>::get(_VSTD::move(__p)); +} + +#endif + +#if _LIBCPP_STD_VER > 11 template<class _Tp, _Tp... _Ip> struct _LIBCPP_TYPE_VIS integer_sequence